package ac.svn.accesscontrol.controller;

import java.awt.Color;
import java.awt.Font;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashSet;
import java.util.Set;

import javax.swing.JToolBar;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;

import ac.notification.event.INotificationListener;
import ac.notification.event.NotificationEvent;
import ac.notification.manager.NotificationRegistrar;
import ac.svn.accesscontrol.manager.IntellisenseManager;
import ac.svn.accesscontrol.store.IResources;
import ac.svn.accesscontrol.store.ISVNIdentifier;
import ac.svn.accesscontrol.store.ISVNItem;
import ac.svn.accesscontrol.ui.IUIConstants;
import ac.svn.accesscontrol.ui.JButton;
import ac.svn.accesscontrol.ui.UIComponentLibrary;
import ac.svn.accesscontrol.ui.helper.ToolbarTitleChangeListener;
import ac.svn.accesscontrol.utils.UIUtility;
import ac.svn.accesscontrol.utils.Utility;

public class ToolBarController implements INotificationListener,
IResources,
IUIConstants,
ISVNIdentifier{

	enum ESelection
	{
		EDIT,
		DELETE,
		OTHER
	}

	public static String TOOLBAR_TITLE = "Quick Operations";

	private JButton btnOpen, btnSave, btnSaveAs,btnSaveConfigData;
	private JButton btnAddRemoveRight;
	private JButton btnManageUsers, btnEditUsers,btnAddUsers,btnDeleteUsers;
	private JButton btnEditGroups,btnAddGroups,btnManageGroup,btnDeleteGroup;
	private JButton btnLocMgr, btnEditLocations,btnAddLocations,btnDeleteLocation;
	private TitledBorder titledBorder;
	private JToolBar toolBar; 

	public ToolBarController()
	{

		btnOpen = new JButton(Utility.getImageIcon(IResources.LOC_ICN_OPEN));
		//btnOpen.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_OPEN)), (new TextIcon(btnOpen,"Open"))));
		btnOpen.setToolTipText("Open an Access file.");
		btnOpen.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Open an access file"));

		btnSave = new JButton(Utility.getImageIcon(IResources.LOC_ICN_SAVE));
		//btnSave.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_SAVE)), (new TextIcon(btnSave,"Save"))));
		btnSave.setToolTipText("Save changes to access file.");
		btnSave.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Save changes to access file."));

		btnSaveAs = new JButton(Utility.getImageIcon(IResources.LOC_ICN_SAVE_AS));
		//btnSaveAs.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_SAVE_AS)), (new TextIcon(btnSaveAs,"Save As.."))));
		btnSaveAs.setToolTipText("Save changes to new access file.");
		btnSaveAs.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Save changes to new access file."));

		btnSaveConfigData = new JButton(Utility.getImageIcon(IResources.LOC_ICN_SAVE_CONFIG));
		//btnSaveConfigData.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_SAVE)), (new TextIcon(btnSaveConfigData,"Config.."))));
		btnSaveConfigData.setToolTipText("Save configuration information to disk.");
		btnSaveConfigData.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Save configuration information to disk."));

		btnOpen = new JButton(Utility.getImageIcon(IResources.LOC_ICN_OPEN));
		//btnOpen.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_OPEN)), (new TextIcon(btnOpen,"Open"))));
		btnOpen.setToolTipText("Open an Access file.");
		btnOpen.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Open an access file"));


		btnAddRemoveRight = new JButton(Utility.getImageIcon(IResources.LOC_ICN_EDIT_ACCESS));
		//btnAddRemoveRight.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_EDIT_ACCESS)), (new TextIcon(btnAddRemoveRight,"Access"))));
		btnAddRemoveRight.setToolTipText("Edit Access");
		btnAddRemoveRight.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Manager Information of Users"));

		//btnAddGroups = new JButton(Utility.getImageIcon(LOC_ICN_ADD_GROUPS));
		btnAddGroups = new JButton(Utility.getImageIcon(IResources.LOC_ICN_ADD_GROUPS));
		//btnAddGroups.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_ADD_GROUPS)), (new TextIcon(btnAddGroups,"Add"))));
		btnAddGroups.setToolTipText("Add Groups");
		btnAddGroups.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Add a group to SubVersion."));

		btnEditGroups = new JButton(Utility.getImageIcon(IResources.LOC_ICN_EDIT_GROUPS));
		//btnEditGroups.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_ADD_GROUPS)), (new TextIcon(btnEditGroups,"Edit"))));
		btnEditGroups.setToolTipText("Edit Groups");
		btnEditGroups.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Edit a group's information and user membership."));


		btnDeleteGroup = new JButton(Utility.getImageIcon(IResources.LOC_ICN_DELETE_GROUPS));
		//btnDeleteGroup.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_DELETE_GROUPS)), (new TextIcon(btnDeleteGroup,"Delete"))));
		btnDeleteGroup.setToolTipText("Delete Groups");
		btnDeleteGroup.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Delete a Group from SubVesion."));

		btnManageGroup = new JButton(Utility.getImageIcon(IResources.LOC_ICN_MANAGE_GROUPS));
		//btnManageGroup.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_MANAGE_GROUPS)), (new TextIcon(btnManageGroup,"Groups"))));
		btnManageGroup.setToolTipText("Manage Groups");
		btnManageGroup.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Group Manager, provides group management options"));

		//Button for Manage user option.
		btnManageUsers    = new JButton(Utility.getImageIcon(IResources.LOC_ICN_MANAGE_USERS));
		//btnManageUsers.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_MANAGE_USERS)), (new TextIcon(btnManageUsers,"Users"))));
		btnManageUsers.setToolTipText("Manage Users");	
		btnManageUsers.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "User Manager, provides user management options."));

		btnAddUsers    = new JButton(Utility.getImageIcon(IResources.LOC_ICN_ADD_USERS));
		//btnAddUsers.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_ADD_USERS)), (new TextIcon(btnAddUsers,"Add"))));
		btnAddUsers.setToolTipText("Add User");	
		btnAddUsers.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Add a user into SubVersion."));

		btnDeleteUsers    = new JButton(Utility.getImageIcon(IResources.LOC_ICN_DELETE_USERS));
		//btnDeleteUsers.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_DELETE_USERS)), (new TextIcon(btnDeleteUsers,"Delete"))));
		btnDeleteUsers.setToolTipText("Delete a User..");	
		btnDeleteUsers.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Delete a user from SubVersion."));

		btnEditUsers    = new JButton(Utility.getImageIcon(IResources.LOC_ICN_EDIT_USERS));
		//btnEditUsers.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_EDIT_USERS)), (new TextIcon(btnEditUsers,"Edit"))));
		btnEditUsers.setToolTipText("Edit Users");
		btnEditUsers.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Edit user's Contact Information, Group Membership and Location access rights."));

		btnLocMgr  = new JButton(Utility.getImageIcon(IResources.LOC_ICN_MANAGE_URLS));
		//btnLocMgr.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_MANAGE_URLS)), (new TextIcon(btnLocMgr,"Locations"))));
		btnLocMgr.setToolTipText("Manage Locations");
		btnLocMgr.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Location Manager, provides locations management options."));

		btnAddLocations  = new JButton(Utility.getImageIcon(IResources.LOC_ICN_ADD_LOCATIONS));
		//btnAddLocations.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_ADD_LOCATIONS)), (new TextIcon(btnAddLocations,"Add"))));
		btnAddLocations.setToolTipText("Add Locations");
		btnAddLocations.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Add a new Location and Access Rights."));

		btnEditLocations  = new JButton(Utility.getImageIcon(IResources.LOC_ICN_EDIT_LOCATIONS));
		//btnEditLocations.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_EDIT_LOCATIONS)), (new TextIcon(btnEditLocations,"Edit"))));
		btnEditLocations.setToolTipText("Edit Locations");
		btnEditLocations.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Edit information and Access rights for a location."));

		btnDeleteLocation  = new JButton(Utility.getImageIcon(IResources.LOC_ICN_DELETE_LOCATIONS));
		//btnDeleteLocation.setIcon(new CompoundIcon(Axis.Y_AXIS, 2,(Utility.getImageIcon(IResources.LOC_ICN_DELETE_LOCATIONS)), (new TextIcon(btnDeleteLocation,"Delete"))));
		btnDeleteLocation.setToolTipText("Delete a Location..");
		btnDeleteLocation.addMouseListener(new ToolbarTitleChangeListener(TOOLBAR_TITLE, "Delete a location and associated rights."));

		toolBar = (JToolBar) UIComponentLibrary.getComponent(IUIConstants.C_TOOL_BAR);
		toolBar.setMargin(new Insets(2,5, 2,2));
		Font font = new Font("Tahoma", Font.BOLD, 12);

		Border border = UIUtility.setAllShadowedBorder(null);
		titledBorder = new TitledBorder(border, TOOLBAR_TITLE, TitledBorder.CENTER, TitledBorder.TOP,font );
		toolBar.setBorder(titledBorder);
		toolBar.setBackground(Color.WHITE);


		toolBar.add(btnOpen);
		toolBar.add(btnSave);
		toolBar.add(btnSaveAs);
		toolBar.add(btnSaveConfigData);
		toolBar.addSeparator();
		toolBar.add(btnManageUsers);
		toolBar.add(btnAddUsers);
		toolBar.add(btnEditUsers);
		toolBar.add(btnDeleteUsers);
		toolBar.addSeparator();
		toolBar.add(btnManageGroup);
		toolBar.add(btnAddGroups);
		toolBar.add(btnEditGroups);
		toolBar.add(btnDeleteGroup);
		toolBar.addSeparator();
		toolBar.add(btnLocMgr);
		toolBar.add(btnAddLocations);
		toolBar.add(btnEditLocations);
		toolBar.add(btnDeleteLocation);
		toolBar.add(btnAddRemoveRight);
		toolBar.addSeparator();


		NotificationRegistrar.registerListener(this);
		registerListener();
	}

	private void registerListener() {

		/**
		 * Handler for Open button press.
		 * */
		btnOpen.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent e) 
			{
				Utility.sendNotification(CMD_OPEN_FILE);
			}
		});

		btnSave.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent e) 
			{
				Utility.sendNotification(CMD_SAVE_FILE);
			}
		});

		btnSaveAs.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent e) 
			{
				Utility.sendNotification(CMD_SAVE_FILE_AS);
			}
		});

		btnSaveConfigData.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent e) 
			{
				//Send Command to merge changes from latest information and then save changes.
				Utility.sendNotification(CMD_MERGE_INFORMATION,Boolean.TRUE);
			}
		});	


		btnManageUsers.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				Utility.sendNotification(CMD_SHOW_USER_INFO_MGR);		
			}
		});


		btnAddRemoveRight.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				/*ISVNItem isvnItem =  IntellisenseManager.getIntellisenseManager().showLocationIntellisense();
		if(null != isvnItem)
		{
		    handleLocationOperation(isvnItem, ESelection.OTHER);					
		}
		else
		{
		    JOptionPane.showMessageDialog(null,"No selection made!","No selection!",JOptionPane.WARNING_MESSAGE);
		}*/
				IntellisenseManager.getIntellisenseManager().showIntellisence(N_LOCATION_ACCESS_SELECTION, IntellisenseManager.EItemsType.TYPE_LOACTION);
			}
		});

		btnEditGroups.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				/*ISVNItem isvnItem = IntellisenseManager.getIntellisenseManager().showGroupIntellisense();
		if(null != isvnItem)
		{
		    if(isvnItem instanceof SVNGroup)
		    {
			handleGroupOperation(isvnItem, ESelection.EDIT);
		    }
		    else
		    {
			System.err.println(String.format("Group selection made on intellesense but return type is unknown! Type found: %s ",isvnItem.getClass().getSimpleName())); 
		    }
		}*/
				IntellisenseManager.getIntellisenseManager().showIntellisence(N_GROUP_EDIT_SELECTION, IntellisenseManager.EItemsType.TYPE_GROUP);
			}
		});


		btnDeleteGroup.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				/*ISVNItem isvnItem = IntellisenseManager.getIntellisenseManager().showGroupIntellisense();
		if(null != isvnItem)
		{
		    if(isvnItem instanceof SVNGroup)
		    {
			handleGroupOperation(isvnItem, ESelection.DELETE);
		    }
		    else
		    {
			System.err.println(String.format("Group selection made on intellesense but return type is unknown! Type found: %s ",isvnItem.getClass().getSimpleName())); 
		    }
		}*/

				IntellisenseManager.getIntellisenseManager().showIntellisence(N_GROUP_DELETE_SELECTION, IntellisenseManager.EItemsType.TYPE_GROUP);
			}
		});

		btnEditUsers.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				/*ISVNItem svnUser = IntellisenseManager.getIntellisenseManager().showUserIntellisense();
		if(null != svnUser)
		{
		    handleUserOperation(svnUser, ESelection.EDIT);
		}
		else
		{
		    System.out.println("No Selection made on");
		}*/
				IntellisenseManager.getIntellisenseManager().showIntellisence(N_USER_EDIT_SELECTION, IntellisenseManager.EItemsType.TYPE_USER);
			}
		});

		btnAddUsers.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				Utility.sendNotification(CMD_CREATE_NEW_USER);
			}
		});

		btnAddGroups.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				Utility.sendNotification(CMD_ADD_GROUP);
			}
		});

		btnManageGroup.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				Utility.sendNotification(CMD_SHOW_GROUP_EDITOR);
			}
		});

		btnDeleteUsers.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				/*ISVNItem isvnItem = IntellisenseManager.getIntellisenseManager().showUserIntellisense();
		if(null != isvnItem)
		{
		    if(isvnItem instanceof SVNUser)
		    {
			handleUserOperation(isvnItem, ESelection.DELETE);
		    }
		    else
		    {
			System.err.println(String.format("User selection made on intellesense but return type is unknown! Type found: %s ",isvnItem.getClass().getSimpleName())); 
		    }
		}*/

				IntellisenseManager.getIntellisenseManager().showIntellisence(N_USER_DELETE_SELECTION , IntellisenseManager.EItemsType.TYPE_USER);
			}
		});


		btnLocMgr.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				Utility.sendNotification(CMD_SHOW_LOC_INFO_MGR) ;
			}
		});

		btnEditLocations.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				/*
		  ISVNItem isvnItem =  IntellisenseManager.getIntellisenseManager().showLocationIntellisense();
		if(null != isvnItem)
		{
		    handleLocationOperation(isvnItem, ESelection.EDIT);					
		}
		else
		{
		    JOptionPane.showMessageDialog(null,"No selection made!","No selection!",JOptionPane.WARNING_MESSAGE);
		}*/

				IntellisenseManager.getIntellisenseManager().showIntellisence(N_LOCATION_EDIT_SELECTION, IntellisenseManager.EItemsType.TYPE_LOACTION);
			}
		});

		btnDeleteLocation.addActionListener(new ActionListener() 
		{
			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				/*ISVNItem isvnItem =  IntellisenseManager.getIntellisenseManager().showLocationIntellisense();
		if(null != isvnItem)
		{
		    handleLocationOperation(isvnItem, ESelection.DELETE);
		}
		else
		{
		    JOptionPane.showMessageDialog(null,"No selection made!","No selection!",JOptionPane.WARNING_MESSAGE);
		}*/

				IntellisenseManager.getIntellisenseManager().showIntellisence(N_LOCATION_DELETE_SELECTION, IntellisenseManager.EItemsType.TYPE_LOACTION);
			}
		});

		btnAddLocations.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) 
			{
				Utility.sendNotification(CMD_ADD_LOCATION) ;
			}
		});

	}

	@Override
	public Set<String> declaredSubscriptionSet() {
		Set<String> subscriptionSet = new HashSet<String>();
		subscriptionSet.add(INTEL_ITEM_SELECTION+INTEL_C_TOOLBAR_CNTRLR);
		subscriptionSet.add(CMD_TOOLBAR_TITLE);

		subscriptionSet.add(N_USER_EDIT_SELECTION);
		subscriptionSet.add(N_USER_DELETE_SELECTION);

		subscriptionSet.add(N_GROUP_EDIT_SELECTION);
		subscriptionSet.add(N_GROUP_DELETE_SELECTION);

		subscriptionSet.add(N_LOCATION_EDIT_SELECTION);
		subscriptionSet.add(N_LOCATION_DELETE_SELECTION);
		subscriptionSet.add(N_LOCATION_ACCESS_SELECTION);

		return subscriptionSet;
	}

	private void handleUserOperation(ISVNItem item, ESelection selType)
	{
		switch (selType) 
		{
		case EDIT:
			Utility.sendNotification(CMD_EDIT_USER, item) ;
			break;
		case DELETE:
			Utility.sendNotification(CMD_DELETE_USER, item) ;
			break;
		default:
			break;
		}
	}

	private void handleGroupOperation(ISVNItem item, ESelection selType)
	{
		switch (selType) 
		{
		case EDIT:
			Utility.sendNotification(CMD_EDIT_GROUP, item);
			break;
		case DELETE:
			Utility.sendNotification(CMD_DELETE_GROUP, item);
			break;
		default:
			break;
		}
	}

	private void handleLocationOperation(ISVNItem item, ESelection selType)
	{
		NotificationEvent notificationEvent = null;

		switch (selType) 
		{
		case EDIT:
			//Send notification stating deletion location automatically.
			notificationEvent = new NotificationEvent(CMD_EDIT_LOCATION);
			notificationEvent.addParameter(P_LOCATION, item);
			notificationEvent.addParameter(P_AUTOMATIC, Boolean.TRUE);
			break;
		case DELETE:
			//Send notification stating deletion location automatically.
			notificationEvent = new NotificationEvent(CMD_DELETE_LOCATION);
			notificationEvent.addParameter(P_LOCATION, item);
			notificationEvent.addParameter(P_AUTOMATIC, Boolean.TRUE);
			break;
		case OTHER:
			notificationEvent = new NotificationEvent(CMD_EDIT_ACCESS);
			notificationEvent.addParameter(P_LOCATION, item);
			NotificationRegistrar.dispatchNotification(notificationEvent);	
			break;
		default:
			break;
		}

		if(null != notificationEvent)
		{
			NotificationRegistrar.dispatchNotification(notificationEvent);   
		}
	}

	@Override
	public void receiveEvent(NotificationEvent notificationEvent) 
	{
		String notId = notificationEvent.getPropertyIdentifier();

		if(notificationEvent.getPropertyIdentifier().contains(INTEL_ITEM_SELECTION))
		{
			String intelSectionType = (String) notificationEvent.getParameter(INTEL_SELECTION_TYPE);
			if(intelSectionType.contains(TYPE_INTEL_GROUP))
			{
				System.err.println("Group Selection Made!");
			}else if(intelSectionType.contains(TYPE_INTEL_USER))
			{
				//SVNUser svnUser = (SVNUser) notificationEvent.getPropertyValue();
			}
		}
		else if(notificationEvent.getPropertyIdentifier().contains(CMD_TOOLBAR_TITLE))
		{
			String borderTitle = (String) notificationEvent.getPropertyValue();
			if(null != borderTitle)
			{
				titledBorder.setTitle(borderTitle);
				toolBar.repaint();
			}
		}

		else if(notId.contains(N_USER_EDIT_SELECTION))
		{
			ISVNItem item = (ISVNItem) notificationEvent.getPropertyValue();
			handleUserOperation(item, ESelection.EDIT);
		}
		else if(notId.contains(N_USER_DELETE_SELECTION))
		{
			ISVNItem item = (ISVNItem) notificationEvent.getPropertyValue();
			handleUserOperation(item, ESelection.DELETE);
		}

		else if(notId.contains(N_GROUP_EDIT_SELECTION))
		{
			ISVNItem item = (ISVNItem) notificationEvent.getPropertyValue();
			handleGroupOperation(item, ESelection.EDIT);
		}
		else if(notId.contains(N_GROUP_DELETE_SELECTION))
		{
			ISVNItem item = (ISVNItem) notificationEvent.getPropertyValue();
			handleGroupOperation(item, ESelection.DELETE);
		}

		else if(notId.contains(N_LOCATION_ACCESS_SELECTION))
		{
			ISVNItem item = (ISVNItem) notificationEvent.getPropertyValue();
			handleLocationOperation(item, ESelection.OTHER);
		}
		else if(notId.contains(N_LOCATION_EDIT_SELECTION))
		{
			ISVNItem item = (ISVNItem) notificationEvent.getPropertyValue();
			handleLocationOperation(item, ESelection.EDIT);
		}
		else if(notId.contains(N_LOCATION_DELETE_SELECTION))
		{
			ISVNItem item = (ISVNItem) notificationEvent.getPropertyValue();
			handleLocationOperation(item, ESelection.DELETE);
		}
	}



}

